package BC115_小乐乐与欧几里得;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        long greatestCommonDivisor = getGreatestCommonDivisor3(a, b);
        long lowestCommonMultiple = getLowestCommonMultiple(a, b, greatestCommonDivisor);
        System.out.println(greatestCommonDivisor + lowestCommonMultiple);
    }

    private static long getLowestCommonMultiple(int a, int b, long greatestCommonDivisor) {
        return (long)a * b / greatestCommonDivisor;
    }


    private static long getGreatestCommonDivisor1(int a, int b) {
        // 暴力穷举
        long n = a > b ? b : a;
        while (n > 1){
            if ((a % n == 0) && (b % n == 0)){
                return n;
            }
            n--;
        }
        return 1;

    }

    private static long getGreatestCommonDivisor2(int a, int b) {
        // 辗转相减
        while (a != b){
            if (a > b){
                a = a - b;
            }else {
                b = b - a;
            }
        }
        return a;

    }

    private static long getGreatestCommonDivisor3(int a, int b) {
        // 辗转相除
        int t = 0;
        while (b != 0){
            t = a % b;
            a = b;
            b = t;
        }
        return b;
    }

}

